#include "mainwindow.h"
#include "ui_mainwindow.h"
#include<QPainter>
MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);
}

MainWindow::~MainWindow()
{
    delete ui;
}

void MainWindow::paintEvent(QPaintEvent *event)
{
     //实例化出图片对象
     QPainter painter(this);
     QPixmap pixmap("://OIP-C.jfif");
     QImage img;
     img.load("://OIP-C.jfif");
     //painter.translate(100,100);//改变原点坐标
     //painter.drawPixmap(0,0,400,200,pixmap);
     //painter.drawPixmap(100,100,400,400,pixmap);//放大图片
     //painter.translate(400,0);
     for(int i=200;i<300;i++)
     {
         for(int j=100;j<200;j++)
        { QRgb rgb=qRgb(0,0,255);
         img.setPixel(i,j,rgb);
       }c
     }
     painter.drawImage(0,0,img);
    //painter.drawPixmap(0,0,400,200,pixmap);//图片重合

}

